#-------------------------------------------------------------------------------
#This file handles all aspects of target library installation
#-------------------------------------------------------------------------------
#All libraries
# INSTALL(
  # TARGETS
    # ${CBC_LIBRARIES}
  # ARCHIVE DESTINATION 
    # lib
# )
#All header files (files ending with .hpp)
FILE(GLOB_RECURSE COINCbc_LIBRARY_HEADER_FILES
     ${CBC_ROOT_DIR}/*.hpp
     ${CBC_ROOT_DIR}/*.h)
INSTALL(
  FILES
    ${COINCbc_LIBRARY_HEADER_FILES}
  DESTINATION
    include/coin
)

#All executables
INSTALL(
  TARGETS
    Cbc ${CBC_EXAMPLE_EXE}
  DESTINATION
    bin
)

#-------------------------------------------------------------------------------
# Help other projects use COINCbc.
SET(LIBRARY_OUTPUT_PATH ${CMAKE_INSTALL_PREFIX}/lib CACHE PATH "Single output directory for building all libraries." FORCE)
SET(COINCbc_LIBRARY_PATH ${LIBRARY_OUTPUT_PATH})

#-------------------------------------------------------------------------------
# Configure files with settings for use by the build.
# Copy the UseCOINCbc.cmake file to the binary tree for backward compatability.
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/UseCOINCbc.cmake.in
               ${CMAKE_INSTALL_PREFIX}/cmake/UseCOINCbc.cmake COPYONLY IMMEDIATE)

# Save library dependencies.
EXPORT_LIBRARY_DEPENDENCIES(${CMAKE_INSTALL_PREFIX}/cmake/COINCbcLibraryDepends.cmake)

# Create the libCOINCbcConfig.cmake file containing the COINCbc configuration.
INCLUDE (${COINCbc_SOURCE_DIR}/GenerateCOINCbcConfig.cmake)

#-------------------------------------------------------------------------------
# Add compiler flags COINCbc needs to work on this platform.  This must be
# done AFTER the call to CMAKE_EXPORT_BUILD_SETTINGS.

SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COINCbc_REQUIRED_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COINCbc_REQUIRED_CXX_FLAGS}")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${COINCbc_REQUIRED_LINK_FLAGS}")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${COINCbc_REQUIRED_LINK_FLAGS}")
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${COINCbc_REQUIRED_LINK_FLAGS}")